package log

import (
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)

var (
	ShowLogger *zap.SugaredLogger = nil
	DBLogger   *zap.Logger        = nil
)

func createShowLogger() {
	logger, _ := zap.NewDevelopment()
	ShowLogger = logger.Sugar()

}

func createDBLogger() {
	writer, _ := NewHooker("127.0.0.1:9005", "log", "log")
	encoder := zapcore.NewJSONEncoder(zap.NewDevelopmentEncoderConfig())
	core := NewCore(zapcore.DebugLevel, encoder, writer)
	DBLogger = zap.New(core, zap.Development(), zap.AddCaller(), zap.AddStacktrace(zapcore.ErrorLevel))

}
func init() {
	createShowLogger()
	createDBLogger()
}
